<template>
  <div align="center">
    <h1>客户信息表修改</h1>
    <table border="1" cellspacing="0">
      <tr>
        <td>公司名称</td>
        <td>主营业务</td>
        <td>地区</td>
        <td>联系人</td>
        <td>联系人职务</td>
        <td>联系人电话</td>
        <td>联系人性别</td>
        <td>传真号码</td>
        <td>银行账号</td>
        <td>邮政编码</td>
        <td>公司规模</td>
        <td>职务员</td>
        <td>客户状态</td>
        <td>加入时间</td>
        <td>操作</td>
      </tr>
      <tr>
        <td v-for="q in data1" v-if="q.id==data.company_name">{{ q.company_name }}</td>
        <td>{{ data.business }}</td>
        <td v-for="w in data3" v-if="w.id==data.region">{{ w.place_name }}</td>
        <td>{{ data.contact }}</td>
        <td>{{ data.job }}</td>
        <td>{{ data.phone }}</td>
        <td>{{ data.gender }}</td>
        <td>{{ data.fax }}</td>
        <td>{{ data.bank }}</td>
        <td v-for="e in data3" v-if="e.id==data.postcode">{{ e.postcode }}</td>
        <td>{{ data.scale }}</td>
        <td v-for="r in data2" v-if="r.id==data.clerk">{{ r.clerk_name }}</td>
        <td>{{ data.is_show }}</td>
        <td>{{ data.date }}</td>
        <td>
          <button @click="amend">修改</button>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      id: this.$route.query.id,
      data: [],
      data1: [],
      data2: [],
      data3: [],
    }
  },
  methods: {
    btn() {
      this.axios.get('clientM/?id=' + this.id)
        .then(res => {
          this.data = res.data
        })
    },
    btn1() {
      this.axios.get('billM/')
        .then(res => {
          this.data1 = res.data
        })
    },
    btn2() {
      this.axios.get('clerkM/')
        .then(res => {
          this.data2 = res.data
        })
    },
    btn3() {
      this.axios.get('regionM/')
        .then(res => {
          this.data3 = res.data
        })
    },
  },
  mounted() {
    this.btn()
    this.btn1()
    this.btn2()
    this.btn3()
  }
}
</script>

<style scoped>

</style>
